﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JDKD.BMCS.Instruction
{
        public abstract class Instruction
        {
                public Instruction(byte type, byte id, bool modify = true, bool isWaitingReceive = false)
                {
                        Type = type;
                        Id = id;
                        Modify = modify;
                        IsWaitingReceive = isWaitingReceive;

                        Content[0] = 0xFF;
                        Content[1] = Type;
                }

                public Byte Type { get; private set; }

                public Byte Id { get; private set; }

                public bool Modify { get; private set; }

                public bool IsWaitingReceive { get; private set; }

                private Byte[] content = new Byte[5];

                public Byte[] Content
                {
                        get
                        {
                                return content;
                        }
                }

                protected void Check()
                {
                        Content[3] = Convert.ToByte(Content[1] + Content[2]);
                        Content[4] = Convert.ToByte(Content[1] ^ Content[2]);
                }
        }
}
